#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>

int main()
{
	pid_t pid;

	pid = fork();
	switch(pid)
	{
		case -1:
			perror("error!");
			exit(0);
		case 0:	//this is children
			printf("children : %d, parent :%d\n",getpid(),getppid());	
			sleep(1);
			printf("Now parent is %d \n",getppid());
			exit(0);
		default://this is parent
			break;
	}
	//while(1);
	exit(0);
}
